import Vue from 'vue'
import moment from 'moment'

Vue.filter('replaceStringToInput', function(string){
    if(string.indexOf('{') > -1 || string.indexOf('}') > -1){
        string = string.replace(/{content}/g, '<el-input v-model="a" placeholder="请输入内容"></el-input>')
    }
    return string;
})

Vue.filter('formatDate', function(value, formatString){
    formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
    if(value){
        return moment(value).format(formatString);
    }else{
      return ""
    }
})

Vue.filter('formatString', function(value){
    if(value == 'null' || value == 'undefined'){
        value = ''
    }
    return value;
})